package cn.wolfcode.luowowo.mgrsite.job;

import cn.wolfcode.luowowo.article.service.IStrategyDetailService;
import cn.wolfcode.luowowo.article.vo.StrategyStatisVO;
import cn.wolfcode.luowowo.cache.service.IStrategyStatisRedisService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by Administrator on 2019/7/13.
 */
//@Component
public class RedisDataPersistenceJob {

    @Reference
    private IStrategyStatisRedisService strategyStatisRedisService;
    @Reference
    private IStrategyDetailService strategyDetailService;
    //指定执行规则
    @Scheduled(cron = "0/10 * * * * ? ")
    public void doWork() {
        List<StrategyStatisVO> vos = strategyStatisRedisService.getStatisVos();
        for (StrategyStatisVO vo : vos) {
            strategyDetailService.updateStatisData(vo);
        }
    }
}
